#include<bits/stdc++.h>
using namespace std;
int n,a,num,ans;
int r[100010];
int main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++) scanf("%d",&a),r[a]++;
    num=0;
    ans=0;
    for(int i=1;i<=100010;i++){
        if(r[i]!=0){
            if(r[i]>=num){
                ans+=num;
                num=r[i];
            }
            if(r[i]<num){
                ans+=r[i];
            }
        }
    }


    cout<<n-ans;



    return 0;
}
